<?php
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->getByDirname($mydirname);

if( $module->getVar('isactive') )
{

	eval('
		function '. $mydirname .'_new($limit=0, $offset=0)
		{
			return links_new_base("'. $mydirname .'", $limit, $offset);
		}
	');


	// --- links_new_base begin ---
	if (!function_exists('links_new_base')) {

		require_once realpath(dirname(__FILE__)) . '/../class/links_Base.class.php';

		function links_new_base($mydirname, $limit=0, $offset=0)
		{
			// $Links OBJ
			$whatsnew = links_Base::getInstance($mydirname);
			$whatsnew->setWhere('l.status', 0, '>');
			$whatsnew->setWhere('l.date', time(), '<');
			$whatsnew->setOrder('l.date DESC');
			$links = $whatsnew->getDatas($limit, $offset);

			$ret = array();
			foreach ($links as $link) {
				$ret[] = array(
					'link'  => $whatsnew->makeUrl('index', 'item', array('lid' => $link['lid'])),
					'title' => $link['title'],
					'hits'  => $link['hits'],
					'time'  => $link['date'],
					'id'    => $link['lid'],
					'uid'   => $link['submitter'],
				);
			}

			return $ret;
		}

	}// --- links_new_base END ---


} //END of if( $module->getVar('isactive') )

